package com.hundsun.yr.universal.p2p.bean;

import java.io.Serializable;
import java.math.BigDecimal;

import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;

import com.hundsun.mobile.zwgt.R;
import com.hundsun.yr.universal.library.utils.HsDateUtils;
import com.hundsun.yr.universal.library.utils.HsNumberUtils;
import com.hundsun.yr.universal.library.utils.MathUtils;
import com.hundsun.yr.universal.library.utils.SpannableStringBuilderUtils;



/**
 * @Title: Invested.java 
 * @Description: 我的投资-已投资
 * @date 2016-1-21 下午4:31:54 
 * @author:hejun.shen
 * @email:shenhj15971@hundsun.com 
 * @replace author:
 * @replace date:
 * @version V1.0   
 */
public class Invested extends ResponseBean implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	/**
	 * 取值的key
	 */
	public static String BASEKEY="userGoodsAssets";

	/**
	 * 年化收益率
	 */
	private BigDecimal annualIncomeRate;
	/**
	 * 到期日 
	 */
	private String endDate;
	/**
	 * 商品编号
	 */
	private String goodsNo;
	/** 
	 * 持有份额 
	 */
	private int holdShare;
	/**
	 * 投资金额
	 */
	private BigDecimal investAmount;
	/**
	 * 投资期限
	 */
	private int ivsmTmLmt;
	/**
	 * 投资期限单位
	 */
	private String ivsmTmLmtUnit;
	/**
	 * 营销商品名称
	 */
	private String marketGoodsName;
	/**
	 * 营销商品编号
	 */
	private String marketGoodsNo;
	/**
	 * 销售结束日期
	 */
	private String salesEndDate;
	/**
	 * 销售开始日期
	 */
	private String salesStartDate;
	/**
	 * 公允单价
	 */
	private BigDecimal standPrice;
	/**
	 * 到期收益 
	 */
	private BigDecimal sumProfitAmt;
	/**
	 * 可转份额
	 */
	private int transferShare;
	/**
	 * 待回款本金
	 */
	private BigDecimal remainBJ;
	/**
	 * 回款总期数
	 */
	private int totalCount;
	/**
	 * 当期已回款期次
	 */
	private int currentPeriod;
	/**
	 * 累计收益
	 */
	private BigDecimal goodsProfitTotal;
	/**
	 * 转让状态(TFR("1", "转让中"), TFRSCSS("2", "售完"), TFRCNCL("3", "部分撤销"), TFRFAIL("4", "已撤销"))
	 */
	private String goodsStatus ;
	/**
	 * 转让费用
	 */
	private BigDecimal tansferFee;

	public Invested(BigDecimal annualIncomeRate, String endDate, String goodsNo, int holdShare, int ivsmTmLmt, BigDecimal investAmount, String ivsmTmLmtUnit, String marketGoodsName, String marketGoodsNo, String salesStartDate, BigDecimal standPrice, String salesEndDate, BigDecimal remainBJ, BigDecimal sumProfitAmt, int transferShare, int totalCount, int currentPeriod, BigDecimal goodsProfitTotal, String goodsStatus, BigDecimal tansferFee) {
		this.annualIncomeRate = annualIncomeRate;
		this.endDate = endDate;
		this.goodsNo = goodsNo;
		this.holdShare = holdShare;
		this.ivsmTmLmt = ivsmTmLmt;
		this.investAmount = investAmount;
		this.ivsmTmLmtUnit = ivsmTmLmtUnit;
		this.marketGoodsName = marketGoodsName;
		this.marketGoodsNo = marketGoodsNo;
		this.salesStartDate = salesStartDate;
		this.standPrice = standPrice;
		this.salesEndDate = salesEndDate;
		this.remainBJ = remainBJ;
		this.sumProfitAmt = sumProfitAmt;
		this.transferShare = transferShare;
		this.totalCount = totalCount;
		this.currentPeriod = currentPeriod;
		this.goodsProfitTotal = goodsProfitTotal;
		this.goodsStatus = goodsStatus;
		this.tansferFee = tansferFee;
	}


	public BigDecimal getAnnualIncomeRate() {
		return annualIncomeRate;
	}




	public void setAnnualIncomeRate(BigDecimal annualIncomeRate) {
		this.annualIncomeRate = annualIncomeRate;
	}




	public String getEndDate() {
		return endDate;
	}




	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}




	public String getGoodsNo() {
		return goodsNo;
	}




	public void setGoodsNo(String goodsNo) {
		this.goodsNo = goodsNo;
	}




	public int getHoldShare() {
		return holdShare;
	}




	public void setHoldShare(int holdShare) {
		this.holdShare = holdShare;
	}




	public BigDecimal getInvestAmount() {
		return investAmount;
	}




	public void setInvestAmount(BigDecimal investAmount) {
		this.investAmount = investAmount;
	}




	public int getIvsmTmLmt() {
		return ivsmTmLmt;
	}




	public void setIvsmTmLmt(int ivsmTmLmt) {
		this.ivsmTmLmt = ivsmTmLmt;
	}




	public String getIvsmTmLmtUnit() {
		return ivsmTmLmtUnit;
	}




	public void setIvsmTmLmtUnit(String ivsmTmLmtUnit) {
		this.ivsmTmLmtUnit = ivsmTmLmtUnit;
	}




	public String getMarketGoodsName() {
		return marketGoodsName;
	}




	public void setMarketGoodsName(String marketGoodsName) {
		this.marketGoodsName = marketGoodsName;
	}




	public String getMarketGoodsNo() {
		return marketGoodsNo;
	}




	public void setMarketGoodsNo(String marketGoodsNo) {
		this.marketGoodsNo = marketGoodsNo;
	}




	public String getSalesEndDate() {
		return salesEndDate;
	}




	public void setSalesEndDate(String salesEndDate) {
		this.salesEndDate = salesEndDate;
	}




	public String getSalesStartDate() {
		return salesStartDate;
	}




	public void setSalesStartDate(String salesStartDate) {
		this.salesStartDate = salesStartDate;
	}




	public BigDecimal getStandPrice() {
		return standPrice;
	}




	public void setStandPrice(BigDecimal standPrice) {
		this.standPrice = standPrice;
	}




	public BigDecimal getSumProfitAmt() {
		return sumProfitAmt;
	}




	public void setSumProfitAmt(BigDecimal sumProfitAmt) {
		this.sumProfitAmt = sumProfitAmt;
	}




	public int getTransferShare() {
		return transferShare;
	}




	public void setTransferShare(int transferShare) {
		this.transferShare = transferShare;
	}




	public BigDecimal getRemainBJ() {
		return remainBJ;
	}




	public void setRemainBJ(BigDecimal remainBJ) {
		this.remainBJ = remainBJ;
	}




	public int getTotalCount() {
		return totalCount;
	}




	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}




	public int getCurrentPeriod() {
		return currentPeriod;
	}




	public void setCurrentPeriod(int currentPeriod) {
		this.currentPeriod = currentPeriod;
	}




	public BigDecimal getGoodsProfitTotal() {
		return goodsProfitTotal;
	}




	public void setGoodsProfitTotal(BigDecimal goodsProfitTotal) {
		this.goodsProfitTotal = goodsProfitTotal;
	}




	public String getGoodsStatus() {
		return goodsStatus;
	}




	public void setGoodsStatus(String goodsStatus) {
		this.goodsStatus = goodsStatus;
	}




	public BigDecimal getTansferFee() {
		return tansferFee;
	}




	public void setTansferFee(BigDecimal tansferFee) {
		this.tansferFee = tansferFee;
	}




	/**
	 * 投资期限单位
	 * @param ivsmTmLmtUnit
	 * @return
	 */
	public String ivsmTmLmtUnit(){
		String way="天";
		if(TextUtils.isEmpty(ivsmTmLmtUnit)){
			return way;
		}
		if(TextUtils.equals(ivsmTmLmtUnit, "DAY")){
			way="天";
		}else if(TextUtils.equals(ivsmTmLmtUnit, "MONTH")){
			way="月";
		}else if(TextUtils.equals(ivsmTmLmtUnit, "YEAR")){
			way="年";
		}
		
		return way;
	}
	
	
	/**
	 * 显示截止时间
	 * @return
	 */
	public String displayEndDate(){
		String end=HsDateUtils.timeformat(HsDateUtils.farmat_date_3,  endDate);
		
		return end;
	}
	
	/**
	 * 显示投资金额
	 * @return
	 */
	public String displayInvestMoney(){
		String money=HsNumberUtils.moneyThousandsFormat(investAmount.toString());
		return money;
	}
	/**
	 * 显示投资金额
	 * 2017-01-18改
	 * @return
	 */
	public String displayInvestMoney_1(){
		String money=HsNumberUtils.moneyThousandsFormat(holdShare);
		return money;
	}
	/**
	 * 显示待收本金
	 * @return
	 */
	public String displayReturnBJ(){
		String money=HsNumberUtils.moneyThousandsFormat(MathUtils.plus(sumProfitAmt.toString(),remainBJ.toString()));
		return money;
	}
	
	/**
	 * 显示待收本金
	 * @return
	 */
	public String displayReturnBJ(BigDecimal profitAmt){
		String money=HsNumberUtils.moneyThousandsFormat(MathUtils.plus(profitAmt.toString(),investAmount.toString()));
		return money;
	}
	
	/**
	 * 显示到期收益
	 * @return
	 */
	public String displaySumProfitAmt(){
		String money=HsNumberUtils.moneyThousandsFormat(sumProfitAmt.toString());
		return money;
	}
	
	/**
	 * 显示到期收益
	 * @return
	 */
	public String displaySumProfitAmt(BigDecimal profitAmt){
		String money=HsNumberUtils.moneyThousandsFormat(profitAmt.toString());
		return money;
	}
	
	
	
	/**
	 * 显示累计收益
	 * @return
	 */
	public SpannableStringBuilder displayProfitTotal(Context context){
		String income=context.getString(R.string._yuan,HsNumberUtils.moneyThousandsFormat(goodsProfitTotal.toString()));
		SpannableStringBuilder builder=SpannableStringBuilderUtils.sizeSpan(income, context.getString(R.string.yuan),14);
		return builder;
	}
	/**
	 * 显示累计收益
	 * @return
	 */
	public SpannableStringBuilder displayProfitTotal(Context context,BigDecimal profitTotal){
		String income=context.getString(R.string._yuan,HsNumberUtils.moneyThousandsFormat(profitTotal.toString()));
		SpannableStringBuilder builder=SpannableStringBuilderUtils.sizeSpan(income, context.getString(R.string.yuan),14);
		return builder;
	}
	/**
	 * 显示年化收益
	 * @return
	 */
	public SpannableStringBuilder displayAnnualincome(Context context){
		String avlincome=HsNumberUtils.numberFormat("##0.00", annualIncomeRate.toString())+context.getString(R.string.percent);
		SpannableStringBuilder builder=SpannableStringBuilderUtils.sizeSpan(avlincome, context.getString(R.string.percent),14);
		return builder;
	}
	
	/**
	 * 详情显示年化收益
	 * @return
	 */
	public String displayAvlincome(Context context){
		
		String avlincome=HsNumberUtils.numberFormat("##0.00", annualIncomeRate.toString())+context.getString(R.string.percent);
		return avlincome;
	}
	
	
}
